import { Result } from "../../../models/HomePage/index";
import { commonApi } from "../../../utils/index";

const getModuleList = (intance, data) => {
    const list = [
        {
            title: "测试",
            id: 1,
            email: "851708184@qq.com"
        },
        {
            title: "测试22222",
            id: 2,
            email: "851708184@qq.com"
        },
        {
            id: 3,
            title: "测试333",
            email: "851708184@qq.com"
        }
    ]
    const { $axios } = intance;
    let item: Result = {
        data: {},
        status: 0,
    };
    return new Promise((resolve, reject) => {
        $axios({
            url: "new/module",
            method: "get",
        }).then(res => {
            if (res && res.status === 200) {
                console.log(commonApi(res.data.data, list, { title: "name" }));
                item.data = commonApi(res.data.data, list, { title: name });
                resolve(item);
            } else {
                item.status = 1;
                resolve(item);
            }
        })
    })
}

export { getModuleList }